"""add monthly quota related fields

Revision ID: 0d328a61b91f
Revises: 068b47f44d83
Create Date: 2025-06-17 09:07:04.009646+00:00

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '0d328a61b91f'
down_revision: Union[str, None] = '068b47f44d83'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('projects', sa.Column('api_quota_monthly_used', sa.Integer(), server_default='0', nullable=False))
    op.add_column('projects', sa.Column('api_quota_last_reset', sa.DateTime(), server_default=sa.text("date_trunc('month', now())"), nullable=False))
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('projects', 'api_quota_last_reset')
    op.drop_column('projects', 'api_quota_monthly_used')
    # ### end Alembic commands ###
